package com.shensi.adminCollect.service.coupon.impl;

import com.shensi.adminCollect.domain.coupon.IssueOilRelations;
import com.shensi.adminCollect.mapper.coupon.IssueOilMapper;
import com.shensi.adminCollect.service.coupon.IIssueOilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 优惠劵Service业务层处理
 * 
 * @author qujia
 * @date 2021-08-09
 */


@Service
public class IssueOilServiceImpl implements IIssueOilService
{
    @Autowired
    private IssueOilMapper issueOilMapper;

    /**
     * 发放方式油品关系
     *
     * @param issueOilId 发放方式油品关系
     * @return 发放方式油品关系
     */
    public IssueOilRelations selectIssueOilRelationsById(Long issueOilId){
        return issueOilMapper.selectIssueOilRelationsById(issueOilId);
    }

    /**
     * 发放方式油品关系
     *
     * @param issueOilRelations 发放方式油品关系
     * @return 发放方式油品关系
     */
    public List<IssueOilRelations> selectIssueOilRelationsList(IssueOilRelations issueOilRelations){
        return issueOilMapper.selectIssueOilRelationsList(issueOilRelations);
    }

    public List<IssueOilRelations> selectIssueNotOilRelationsList(IssueOilRelations issueOilRelations){
        return issueOilMapper.selectIssueNotOilRelationsList(issueOilRelations);
    }

    /**
     * 发放方式油品关系
     *
     * @param issueOilRelations 发放方式油品关系
     * @return 结果
     */
    public int insertIssueOilRelations(IssueOilRelations issueOilRelations){
        return issueOilMapper.insertIssueOilRelations(issueOilRelations);
    }


    /**
     * 发放方式油品关系
     *
     * @param issueOilRelations 发放方式油品关系
     * @return 结果
     */
    public int insertIssueNotOilRelations(IssueOilRelations issueOilRelations){
        return issueOilMapper.insertIssueNotOilRelations(issueOilRelations);
    }

    /**
     * 发放方式油品关系
     *
     * @param issueOilRelations 发放方式油品关系
     * @return 结果
     */
    public int updateIssueOilRelations(IssueOilRelations issueOilRelations){
        return issueOilMapper.updateIssueOilRelations(issueOilRelations);
    }

    /**
     * 删除优惠劵发放方式油站
     *
     * @param id 发放方式油站关系
     * @return 结果
     */
    public int deleteIssueOilRelationsById(Integer id){
        return issueOilMapper.deleteIssueOilRelationsById(id);
    }


    /**
     * 通过发放方式的id删除关联表
     *
     * @param issueId 发放方式id
     * @return 结果
     */
    public int deleteIssueOilRelationsByIssueId(String issueId){
        int a =   issueOilMapper.deleteIssueOilRelationsByIssueId(issueId);
        int b =   issueOilMapper.deleteIssueNotOilRelationsByIssueId(issueId);
        return a+b;
    }

    /**
     * 批量删除优惠劵发放方式油站
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteIssueOilRelationsByIds(Integer[] ids){
        int a =   issueOilMapper.deleteIssueOilRelationsByIds(ids);
        int b =   issueOilMapper.deleteIssueNotOilRelationsByIds(ids);
        return a+b;
    }

    /**
     * 批量删除优惠劵发放方式油站
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteIssueOilRelationsByIssueIds(Long[] ids){
      int a =   issueOilMapper.deleteIssueOilRelationsByIssueIds(ids);
        int b =   issueOilMapper.deleteIssueNotOilRelationsByIssueIds(ids);
        return a+b;
    }
}
